/*港口公司总数*/
create or replace function count_port()
returns integer as $$

declare
counts integer;

begin select count(*) into counts from port_companies;
return counts;
end;

$$ language plpgsql;

/*调用函数*/
select count_port();